﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.ComponentModel;

namespace NamazVakti
{
    class PaintedListView : ListView
    {
        public void WriteRemainingTime(float percentage, int minutes)
        {
            //Control parent = GetParent(this);
            //if (parent == null) return;
            Graphics g = Graphics.FromHdc(this.Handle);//.CreateGraphics();
            g.FillRectangle(new SolidBrush(Color.PaleVioletRed), new Rectangle(0, 0, (int)(Width * percentage), Height));
            //g.DrawString(string.Format("Kalan {0} dk", minutes), new Font("Arial", 10, FontStyle.Regular), new SolidBrush(Color.Black), this.ClientRectangle);
            g.Dispose();
        }

        protected Control GetParent(Control c)
        {
            if (c is Form)
                return c;
            else if (c.Parent != null)
                return c.Parent;
            else
                return null;
        }
    }
}
